package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * fx
 * 创建约饭活动
 */
public class ChuangJianYueFanTask extends CouponHttpBaseTask {

    private String mActivityTitle;
   // private String mAddress;
    private String mAreaName;
    private String mTradingAreaId;
    private String mStartTime;
    private String mLastTime;
    private String mDescription;
//    private String mFee;
    private String mMaxCount;
    private String mSexLimit;
    private String mJoinWay;
//    private String mExitWay;
//    private String selectCaipin;
    private String mbusinessEndTime;


    public ChuangJianYueFanTask(String activityTitle, String areaName, String tradingAreaId, String businessEndTime ,String startTime, String lastTime, String description,
                                 String maxCount, String sexLimit, String joinWay) {
        super(TaskType.CHUANGJIANYUEFAN_TASK);
        mActivityTitle = activityTitle;
        mAreaName = areaName;
        mTradingAreaId = tradingAreaId;
        mbusinessEndTime = businessEndTime;
        mStartTime = startTime;
        mLastTime = lastTime;
        mDescription = description;
//        mFee = fee;
        mMaxCount = maxCount;
        mSexLimit = sexLimit;
        mJoinWay = joinWay;
//        mExitWay = exitWay;
//        selectCaipin = caipin;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, null);
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest(RequestType.CHUANGJIANYUEFAN_REQUEST);
            JSONObject json = new JSONObject();
            json.put("activityTitle", mActivityTitle);
            json.put("areaName", mAreaName);
            json.put("tradingAreaId", mTradingAreaId);
            json.put("businessEndTime", mbusinessEndTime);
            json.put("startTime", mStartTime);
            json.put("lastTime", mLastTime);
            json.put("description", mDescription);
            json.put("maxCount", mMaxCount);
            json.put("sexLimit", mSexLimit);
            json.put("joinWay", mJoinWay);
            request.setData(json.toString());
            request.setApiNo(ApiNo.CHUANGJIANYUEFAN);
            addRequest(request);
        }
    }

}
